In [11]:
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
import folium
import geopandas as gpd
In [13]:
df=pd.read_csv(r'C:\Users\venkata sai kapa\OneDrive\Desktop\Dataset.csv')
In [17]:
if "Latitude" and "Longitude" in df.columns:
plt.figure(figsize=(20, 7))
plt.scatter(df["Longitude"], df["Latitude"], alpha=0.5)
plt.xlabel("Longitude")
plt.ylabel("Latitude")
plt.title("Restaurant Distribution")
plt.show()
else:
print("Latitude and longitude columns not found.")
In [19]:
restaurants_gdf = gpd.GeoDataFrame(df, geometry=gpd.points_from_xy(df['Longitude'], df['Latitude']))
# create a map centered around the mean latitude and longitude of the restaurant locations
map_restaurants = folium.Map(location=[restaurants_gdf['geometry'].y.mean(), restaurants_gdf['geometry'].x.mean()], zoom_start=12)
restaurants_gdf.crs = 'EPSG:4326'
folium.GeoJson(restaurants_gdf).add_to(map_restaurants)
#map_restaurants.save('restaurants_map.html')
map_restaurants
Out[19]:
Make this Notebook Trusted to load map: File -> Trust Notebook
In [ ]: